<?php
	
	class Application{
		public $uri;
		private $model;
		
		function __construct($uri){
			$this->uri = $uri;
		}
		public function loadController($class){
			$file = "controller/".$this->uri['model'].".php";
			if(!file_exists($file)){echo 'Module does not exist'; die();}
			require_once($file);
			$controller = new $class();

			if(method_exists($controller, $this->uri['method'])){
			 	$controller->{$this->uri['method']}($this->uri['var']);
			} else {
				$controller->index();
			}
		}
		public function loadView($view,$vars=""){
			if(is_array($vars) && count($vars) > 0)
				extract($vars, EXTR_PREFIX_SAME, "wddx");
			require_once($view.'.php');
		}
		public function loadModel($model){
			require_once('model/'.$model.'.php');
			$this->$model = new $model;
		}
        public function loadModule() {
    		return return_array_multi("SELECT model_id FROM `dos_sys_models`");
    	}
	}

?>